home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / mail / elm / elm2.4.p24b.Z / elm2.4.p24b
Encoding:
Text File  |  1994-09-23  |  63.2 KB  |  2,222 lines

  1. Subject: elm 2.4 Patch #24b
  2. Date: Fri Sep 23 21:43:13 EDT 1994
  3. Summary: This is an official patch for elm 2.4 system.  Please apply it.
  4. Priority: LOW
  5.  
  6. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your elm source
  7.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  8.     If you don't have the patch program, apply the following by hand,
  9.     or get patch (version 2.0, latest patchlevel).
  10.  
  11.     After patching:
  12.         apply patch 24c
  13.  
  14.     If patch indicates that patchlevel is the wrong version, you may need
  15.     to apply one or more previous patches, or the patch may already
  16.     have been applied.  See the patchlevel.h file to find out what has or
  17.     has not been applied.  In any event, don't continue with the patch.
  18.  
  19.     If you are missing previous patches they can be obtained from our:
  20.     archive server.
  21.  
  22.     Syd Weinstein
  23.     elm@Myxa.com
  24.  
  25.     The patches are available from the dsinc archive server
  26.     Send the following message to archive-server@Myxa.com for
  27.     a list of available patches:
  28.  
  29.     Subject: patch list
  30.     send index elm
  31.  
  32. Index: lib/ldstate.c
  33. Prereq: 5.6
  34. *** ../elm2.4/lib/ldstate.c    Sun Sep 26 22:14:50 1993
  35. --- lib/ldstate.c    Fri Mar 11 16:01:35 1994
  36. ***************
  37. *** 1,8 ****
  38.   
  39. ! static char rcsid[] = "@(#)$Id: ldstate.c,v 5.6 1993/08/23 02:46:51 syd Exp $";
  40.   
  41.   /*******************************************************************************
  42. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  43.    *
  44.    *            Copyright (c) 1992 USENET Community Trust
  45.    *******************************************************************************
  46. --- 1,8 ----
  47.   
  48. ! static char rcsid[] = "@(#)$Id: ldstate.c,v 5.7 1994/03/11 21:01:35 syd Exp $";
  49.   
  50.   /*******************************************************************************
  51. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  52.    *
  53.    *            Copyright (c) 1992 USENET Community Trust
  54.    *******************************************************************************
  55. ***************
  56. *** 13,18 ****
  57. --- 13,22 ----
  58.    *
  59.    *******************************************************************************
  60.    * $Log: ldstate.c,v $
  61. +  * Revision 5.7  1994/03/11  21:01:35  syd
  62. +  * detect whether atol() is a macro
  63. +  * From: Mitch DSouza <m.dsouza@mrc-applied-psychology.cambridge.ac.uk>
  64. +  *
  65.    * Revision 5.6  1993/08/23  02:46:51  syd
  66.    * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
  67.    * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  68. ***************
  69. *** 61,67 ****
  70.    * the (struct folder_state) record.
  71.    */
  72.   
  73. ! #if !ANSI_C  /* avoid problems with systems that declare atol as a macro */
  74.   extern long atol();
  75.   #endif
  76.   
  77. --- 65,71 ----
  78.    * the (struct folder_state) record.
  79.    */
  80.   
  81. ! #if !defined(ANSI_C) && !defined(atol)  /* avoid problems with systems that declare atol as a macro */
  82.   extern long atol();
  83.   #endif
  84.   
  85.  
  86. Index: lib/mcprt.c
  87. Prereq: 5.5
  88. *** ../elm2.4/lib/mcprt.c    Sun Sep 26 22:14:50 1993
  89. --- lib/mcprt.c    Thu Jun 30 12:44:02 1994
  90. ***************
  91. *** 1,5 ****
  92.   
  93. ! static char rcsid[] = "@(#)$Id: mcprt.c,v 5.5 1993/08/23 02:49:35 syd Exp $";
  94.   
  95.   /***********************************************************
  96.   Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
  97. --- 1,5 ----
  98.   
  99. ! static char rcsid[] = "@(#)$Id: mcprt.c,v 5.6 1994/06/30 16:43:14 syd Exp $";
  100.   
  101.   /***********************************************************
  102.   Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
  103. ***************
  104. *** 49,55 ****
  105.   #include "mcprt.h"
  106.   #include "mcprtlib.h"
  107.   
  108. ! #ifdef    I_STDARG
  109.   int    MCprintf(char *fmt, ...)
  110.   #else
  111.   int    MCprintf(fmt, va_alist)
  112. --- 49,55 ----
  113.   #include "mcprt.h"
  114.   #include "mcprtlib.h"
  115.   
  116. ! #ifdef    ANSI_C
  117.   int    MCprintf(char *fmt, ...)
  118.   #else
  119.   int    MCprintf(fmt, va_alist)
  120. ***************
  121. *** 71,77 ****
  122.       return len;
  123.   }
  124.   
  125. ! #ifdef    I_STDARG
  126.   int    MCfprintf(FILE *fptr, char *fmt, ...)
  127.   #else
  128.   int    MCfprintf(fptr, fmt, va_alist)
  129. --- 71,77 ----
  130.       return len;
  131.   }
  132.   
  133. ! #ifdef    ANSI_C
  134.   int    MCfprintf(FILE *fptr, char *fmt, ...)
  135.   #else
  136.   int    MCfprintf(fptr, fmt, va_alist)
  137. ***************
  138. *** 94,100 ****
  139.       return len;
  140.   }
  141.   
  142. ! #ifdef    I_STDARG
  143.   int    MCsprintf(char *cptr, char *fmt, ...)
  144.   #else
  145.   int    MCsprintf(cptr, fmt, va_alist)
  146. --- 94,100 ----
  147.       return len;
  148.   }
  149.   
  150. ! #ifdef    ANSI_C
  151.   int    MCsprintf(char *cptr, char *fmt, ...)
  152.   #else
  153.   int    MCsprintf(cptr, fmt, va_alist)
  154.  
  155. Index: lib/ndbz.c
  156. Prereq: 5.11
  157. *** ../elm2.4/lib/ndbz.c    Sun Sep 26 22:14:51 1993
  158. --- lib/ndbz.c    Fri Mar 11 16:34:01 1994
  159. ***************
  160. *** 1,7 ****
  161. ! static char rcsid[] = "@(#)$Id: ndbz.c,v 5.11 1993/08/23 02:46:51 syd Exp $";
  162.   
  163.   /*******************************************************************************
  164. !  *  The Elm Mail System  -  $Revision: 5.11 $   $State: Exp $
  165.    *
  166.    *            Copyright (c) 1988-1992 USENET Community Trust
  167.    *            Copyright (c) 1986,1987 Dave Taylor
  168. --- 1,7 ----
  169. ! static char rcsid[] = "@(#)$Id: ndbz.c,v 5.12 1994/03/11 21:01:35 syd Exp $";
  170.   
  171.   /*******************************************************************************
  172. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  173.    *
  174.    *            Copyright (c) 1988-1992 USENET Community Trust
  175.    *            Copyright (c) 1986,1987 Dave Taylor
  176. ***************
  177. *** 13,18 ****
  178. --- 13,22 ----
  179.    *
  180.    *******************************************************************************
  181.    * $Log: ndbz.c,v $
  182. +  * Revision 5.12  1994/03/11  21:01:35  syd
  183. +  * detect whether atol() is a macro
  184. +  * From: Mitch DSouza <m.dsouza@mrc-applied-psychology.cambridge.ac.uk>
  185. +  *
  186.    * Revision 5.11  1993/08/23  02:46:51  syd
  187.    * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
  188.    * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  189. ***************
  190. *** 274,280 ****
  191.   #define    MAPOUT(o)    ((db->dbz_bytesame) ? (o) : bytemap((o), db->dbz_mybmap, db->dbz_conf.bytemap))
  192.   
  193.   /* externals used */
  194. ! #if !ANSI_C  /* avoid problems with systems that declare atol as a macro */
  195.   extern long atol();
  196.   #endif
  197.   
  198. --- 278,284 ----
  199.   #define    MAPOUT(o)    ((db->dbz_bytesame) ? (o) : bytemap((o), db->dbz_mybmap, db->dbz_conf.bytemap))
  200.   
  201.   /* externals used */
  202. ! #if !defined(atol)  /* avoid problems with systems that declare atol as a macro */
  203.   extern long atol();
  204.   #endif
  205.   
  206.  
  207. Index: lib/opt_utils.c
  208. Prereq: 5.8
  209. *** ../elm2.4/lib/opt_utils.c    Sun Sep 26 22:14:52 1993
  210. --- lib/opt_utils.c    Mon May 30 12:31:56 1994
  211. ***************
  212. *** 1,8 ****
  213.   
  214. ! static char rcsid[] = "@(#)$Id: opt_utils.c,v 5.8 1993/08/03 19:28:39 syd Exp $";
  215.   
  216.   /*******************************************************************************
  217. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  218.    *
  219.    *            Copyright (c) 1988-1992 USENET Community Trust
  220.    *            Copyright (c) 1986,1987 Dave Taylor
  221. --- 1,8 ----
  222.   
  223. ! static char rcsid[] = "@(#)$Id: opt_utils.c,v 5.9 1994/05/30 16:31:40 syd Exp $";
  224.   
  225.   /*******************************************************************************
  226. !  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
  227.    *
  228.    *            Copyright (c) 1988-1992 USENET Community Trust
  229.    *            Copyright (c) 1986,1987 Dave Taylor
  230. ***************
  231. *** 14,19 ****
  232. --- 14,23 ----
  233.    *
  234.    *******************************************************************************
  235.    * $Log: opt_utils.c,v $
  236. +  * Revision 5.9  1994/05/30  16:31:40  syd
  237. +  * make getpwuid dependent on ANSI_C not posix flag
  238. +  * From: Syd
  239. +  *
  240.    * Revision 5.8  1993/08/03  19:28:39  syd
  241.    * Elm tries to replace the system toupper() and tolower() on current
  242.    * BSD systems, which is unnecessary.  Even worse, the replacements
  243. ***************
  244. *** 185,191 ****
  245.        **/
  246.   
  247.     struct passwd *password_entry;
  248. ! #ifndef _POSIX_SOURCE
  249.     struct passwd *getpwuid();
  250.   #endif
  251.     char   *name, *getlogin();
  252. --- 189,195 ----
  253.        **/
  254.   
  255.     struct passwd *password_entry;
  256. ! #ifndef ANSI_C
  257.     struct passwd *getpwuid();
  258.   #endif
  259.     char   *name, *getlogin();
  260.  
  261. Index: lib/realfrom.c
  262. Prereq: 5.4
  263. *** ../elm2.4/lib/realfrom.c    Sun Sep 26 22:14:52 1993
  264. --- lib/realfrom.c    Tue Aug 30 11:11:20 1994
  265. ***************
  266. *** 1,8 ****
  267.   
  268. ! static char rcsid[] = "@(#)$Id: realfrom.c,v 5.4 1993/08/03 19:28:39 syd Exp $";
  269.   
  270.   /*******************************************************************************
  271. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  272.    *
  273.    *             Copyright (c) 1993 USENET Community Trust
  274.    *******************************************************************************
  275. --- 1,8 ----
  276.   
  277. ! static char rcsid[] = "@(#)$Id: realfrom.c,v 5.5 1994/08/30 15:11:20 syd Exp $";
  278.   
  279.   /*******************************************************************************
  280. !  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  281.    *
  282.    *             Copyright (c) 1993 USENET Community Trust
  283.    *******************************************************************************
  284. ***************
  285. *** 13,18 ****
  286. --- 13,24 ----
  287.    *
  288.    *******************************************************************************
  289.    * $Log: realfrom.c,v $
  290. +  * Revision 5.5  1994/08/30  15:11:20  syd
  291. +  * Work around null from names by looking to see whether the second or
  292. +  * third field is a valid month and using that to determine if there
  293. +  * is an address.
  294. +  * From: alex@samwise.dccs.upenn.edu (Alex Garthwaite)
  295. +  *
  296.    * Revision 5.4  1993/08/03  19:28:39  syd
  297.    * Elm tries to replace the system toupper() and tolower() on current
  298.    * BSD systems, which is unnecessary.  Even worse, the replacements
  299. ***************
  300. *** 72,77 ****
  301. --- 78,85 ----
  302.        */
  303.   
  304.       char field[STRING];        /* buffer for current field of line    */
  305. +     char field2[STRING];        /* buffer for current field of line    */
  306. +     char field3[STRING];        /* buffer for current field of line    */
  307.       char save_tz[STRING];    /* extracted time zone field        */
  308.       int len;            /* length of current field        */
  309.       int month, day, year, hours, mins, secs, tz, i;
  310. ***************
  311. *** 93,122 ****
  312.       buffer += 5;
  313.       dprint(7, (debugfile, "real_from parsing %s", buffer));
  314.   
  315. !     /* <user> */
  316.       if ((len = get_word(buffer, 0, field, sizeof(field))) < 0)
  317.       goto failed;
  318.       buffer += len;
  319. -     if (entry != NULL)
  320. -     strfcpy(entry->from, field, sizeof(entry->from));
  321. -     dprint(7, (debugfile, "  user=%s\n", field));
  322.   
  323. !     /* <weekday> */
  324. !     if ((len = get_word(buffer, 0, field, sizeof(field))) < 0)
  325.       goto failed;
  326.       buffer += len;
  327.   
  328. !     /* <month> */
  329. !     if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 ||
  330. !         !cvt_monthname_to_monthnum(field, &month))
  331.       goto failed;
  332.       buffer += len;
  333.   
  334. !     /* <day> */
  335. !     if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 ||
  336. !         (day = atonum(field)) < 0 || day < 1 || day > 31)
  337.       goto failed;
  338. !     buffer += len;
  339.   
  340.       /* <hr:min:sec> */
  341.       if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 ||
  342. --- 101,150 ----
  343.       buffer += 5;
  344.       dprint(7, (debugfile, "real_from parsing %s", buffer));
  345.   
  346. !     /* <user> or <weekday> */
  347.       if ((len = get_word(buffer, 0, field, sizeof(field))) < 0)
  348.       goto failed;
  349.       buffer += len;
  350.   
  351. !     /* <weekday> or <month> */
  352. !     if ((len = get_word(buffer, 0, field2, sizeof(field2))) < 0)
  353.       goto failed;
  354.       buffer += len;
  355.   
  356. !     /* <month> or <day> */
  357. !     if ((len = get_word(buffer, 0, field3, sizeof(field3))) < 0 )
  358.       goto failed;
  359.       buffer += len;
  360.   
  361. !     /* is <month> in field2 or field3? */
  362. !     if (!cvt_monthname_to_monthnum(field3, &month))
  363. !       if (!cvt_monthname_to_monthnum(field2, &month))
  364.       goto failed;
  365. !       else
  366. !     {
  367. !       /*  field2 is month, field3 is day  */
  368. !           /* <user> */
  369. !           if (entry != NULL)
  370. !           *( entry->from ) = '\0';
  371. !           dprint(7, (debugfile, "  user=\n"));
  372. !           /* <day> */
  373. !           if ((day = atonum(field3)) < 0 || day < 1 || day > 31)
  374. !           goto failed;
  375. !     }
  376. !     else
  377. !       {
  378. !         /* <user> */
  379. !         if (entry != NULL)
  380. !         strfcpy(entry->from, field, sizeof(field));
  381. !         dprint(7, (debugfile, "  user=%s\n", field));
  382. !         /* <day> */
  383. !         if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 ||
  384. !             (day = atonum(field)) < 0 || day < 1 || day > 31)
  385. !         goto failed;
  386. !         buffer += len;
  387. !       }
  388.   
  389.       /* <hr:min:sec> */
  390.       if ((len = get_word(buffer, 0, field, sizeof(field))) < 0 ||
  391.  
  392. Index: lib/shiftlower.c
  393. Prereq: 5.2
  394. *** ../elm2.4/lib/shiftlower.c    Sun Sep 26 22:14:53 1993
  395. --- lib/shiftlower.c    Fri Mar 11 17:11:09 1994
  396. ***************
  397. *** 1,7 ****
  398. ! static char rcsid[] = "@(#)$Id: shiftlower.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  399.   
  400.   /*******************************************************************************
  401. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  402.    *
  403.    *            Copyright (c) 1988-1992 USENET Community Trust
  404.    *            Copyright (c) 1986,1987 Dave Taylor
  405. --- 1,7 ----
  406. ! static char rcsid[] = "@(#)$Id: shiftlower.c,v 5.3 1994/03/11 22:11:09 syd Exp $";
  407.   
  408.   /*******************************************************************************
  409. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  410.    *
  411.    *            Copyright (c) 1988-1992 USENET Community Trust
  412.    *            Copyright (c) 1986,1987 Dave Taylor
  413. ***************
  414. *** 13,18 ****
  415. --- 13,26 ----
  416.    *
  417.    *******************************************************************************
  418.    * $Log: shiftlower.c,v $
  419. +  * Revision 5.3  1994/03/11  22:11:09  syd
  420. +  * There is a bug in the alias-system of elm-2.4.23 that did not appear in
  421. +  * elm-2.4.21. When searching for a string in the alias-table with the '//'
  422. +  * command, elm sometimes gets a segmentation fault. With help of a debugger,
  423. +  * I found that the function shift_lower gets a NULL argument. A fix is
  424. +  * appended, but maybe the problem lies elsewhere.
  425. +  * From: Sjaak Schilperoort <J.W.Schilperoort@research.ptt.nl>
  426. +  *
  427.    * Revision 5.2  1993/08/03  19:28:39  syd
  428.    * Elm tries to replace the system toupper() and tolower() on current
  429.    * BSD systems, which is unnecessary.  Even worse, the replacements
  430. ***************
  431. *** 46,51 ****
  432. --- 54,63 ----
  433.       static char buffer[VERY_LONG_STRING];
  434.       register char *bufptr = buffer;
  435.   
  436. +     if (string == NULL) {
  437. +         buffer[0] = 0;
  438. +         return( (char *) buffer);
  439. +     }
  440.       for (; *string; string++, bufptr++)
  441.         *bufptr = tolower(*string);
  442.       
  443.  
  444. Index: lib/strftime.c
  445. Prereq: 5.8
  446. *** ../elm2.4/lib/strftime.c    Sun Sep 26 22:14:53 1993
  447. --- lib/strftime.c    Sun May 15 20:05:33 1994
  448. ***************
  449. *** 1,8 ****
  450.   
  451. ! static char rcsid[] = "@(#)$Id: strftime.c,v 5.8 1993/08/23 02:46:51 syd Exp $";
  452.   
  453.   /*******************************************************************************
  454. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  455.    *
  456.    * Public-domain relatively quick-and-dirty implemenation of
  457.    * ANSI library routine for System V Unix systems.
  458. --- 1,8 ----
  459.   
  460. ! static char rcsid[] = "@(#)$Id: strftime.c,v 5.11 1994/05/16 00:05:27 syd Exp $";
  461.   
  462.   /*******************************************************************************
  463. !  *  The Elm Mail System  -  $Revision: 5.11 $   $State: Exp $
  464.    *
  465.    * Public-domain relatively quick-and-dirty implemenation of
  466.    * ANSI library routine for System V Unix systems.
  467. ***************
  468. *** 19,24 ****
  469. --- 19,46 ----
  470.    *
  471.    *******************************************************************************
  472.    * $Log: strftime.c,v $
  473. +  * Revision 5.11  1994/05/16  00:05:27  syd
  474. +  * Update to strftime-6.1
  475. +  * From: Syd
  476. +  *
  477. +  * Revision 5.10  1994/03/11  20:55:23  syd
  478. +  * Replaced the get_tz_mins() routine in lib/get_tz.c with a portable
  479. +  * version that requires no configuration.  Rewrote the test case in
  480. +  * lib/get_tz.c, and also wrote in support to simplify configuration
  481. +  * tests.  Dropped TZMINS_USE_XXXX configuration parameter.  Simplified
  482. +  * timezone determination in Configure.  The new get_tz_mins() introduces
  483. +  * two side effects.  First it steps on the static data returned by
  484. +  * localtime().  Second, it uses a routine in lib/date_util.c, which
  485. +  * requires debug initializations.  Rewrote get_arpa_date() to work around
  486. +  * the first issue.  Rather than doing the same for lib/strftime.c, just
  487. +  * removed the timezone stuff with a conditional compile.  Elm does not
  488. +  * use it.  Added debugging initializations to util/fastmail.c.
  489. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  490. +  *
  491. +  * Revision 5.9  1994/03/11  20:43:42  syd
  492. +  * Fix ANSI prototype stripping macro
  493. +  * From: "Tom Moore" <tmoore@fievel.DaytonOH.NCR.COM>
  494. +  *
  495.    * Revision 5.8  1993/08/23  02:46:51  syd
  496.    * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
  497.    * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  498. ***************
  499. *** 91,102 ****
  500.    * Arnold Robbins
  501.    * January, February, March, 1991
  502.    * Updated March, April 1992
  503. !  * Updated May, 1993
  504.    *
  505.    * Fixes from ado@elsie.nci.nih.gov
  506.    * February 1991, May 1992
  507. !  * Fixes from Tor Lillqvist tor@tik.vtt.fi
  508.    * May, 1993
  509.    */
  510.   
  511.   #include "headers.h"
  512. --- 113,128 ----
  513.    * Arnold Robbins
  514.    * January, February, March, 1991
  515.    * Updated March, April 1992
  516. !  * Updated April, 1993
  517. !  * Updated February, 1994
  518. !  * Updated May, 1994
  519.    *
  520.    * Fixes from ado@elsie.nci.nih.gov
  521.    * February 1991, May 1992
  522. !  * Fixes from Tor Lillqvist tml@tik.vtt.fi
  523.    * May, 1993
  524. +  * Further fixes from ado@elsie.nci.nih.gov
  525. +  * February 1994
  526.    */
  527.   
  528.   #include "headers.h"
  529. ***************
  530. *** 111,122 ****
  531.   #if ANSI_C
  532.   # define P_(x) x
  533.   #else
  534. ! # define P_(x) /**/
  535.   # define const    /**/
  536.   #endif
  537.   
  538. - extern char *get_tz_name();
  539.   #ifndef BSD
  540.   extern void tzset P_((void));
  541.   #endif
  542. --- 137,146 ----
  543.   #if ANSI_C
  544.   # define P_(x) x
  545.   #else
  546. ! # define P_(x) () /**/
  547.   # define const    /**/
  548.   #endif
  549.   
  550.   #ifndef BSD
  551.   extern void tzset P_((void));
  552.   #endif
  553. ***************
  554. *** 146,152 ****
  555.   
  556.   #undef strchr    /* avoid AIX weirdness */
  557.   
  558. ! adddecl(static int iso8601wknum();)
  559.   
  560.   #ifdef __GNUC__
  561.   #define inline    __inline__
  562. --- 170,176 ----
  563.   
  564.   #undef strchr    /* avoid AIX weirdness */
  565.   
  566. ! adddecl(static int iso8601wknum P_((const struct tm *timeptr));)
  567.   
  568.   #ifdef __GNUC__
  569.   #define inline    __inline__
  570. ***************
  571. *** 156,161 ****
  572. --- 180,190 ----
  573.   
  574.   #define range(low, item, hi)    maximum(low, minimum(item, hi))
  575.   
  576. + #if !defined(OS2) && !defined(MSDOS) && defined(TZNAME_USE_TZNAME)
  577. + extern char *tzname[2];
  578. + extern int daylight;
  579. + #endif
  580.   /* minimum --- return minimum of two numbers */
  581.   
  582.   #if !ANSI_C
  583. ***************
  584. *** 208,237 ****
  585.       static int savetzlen = 0;
  586.       char *tz;
  587.   #endif /* POSIX_SEMANTICS */
  588.   
  589.       /* various tables, useful in North America */
  590. !     static char *days_a[] = {
  591.           "Sun", "Mon", "Tue", "Wed",
  592.           "Thu", "Fri", "Sat",
  593.       };
  594. !     static char *days_l[] = {
  595.           "Sunday", "Monday", "Tuesday", "Wednesday",
  596.           "Thursday", "Friday", "Saturday",
  597.       };
  598. !     static char *months_a[] = {
  599.           "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  600.           "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
  601.       };
  602. !     static char *months_l[] = {
  603.           "January", "February", "March", "April",
  604.           "May", "June", "July", "August", "September",
  605.           "October", "November", "December",
  606.       };
  607. !     static char *ampm[] = { "AM", "PM", };
  608.   
  609.       if (s == NULL || format == NULL || timeptr == NULL || maxsize == 0)
  610.           return 0;
  611.   
  612.       if (strchr(format, '%') == NULL && strlen(format) + 1 >= maxsize)
  613.           return 0;
  614.   
  615. --- 237,272 ----
  616.       static int savetzlen = 0;
  617.       char *tz;
  618.   #endif /* POSIX_SEMANTICS */
  619. + #ifdef TZNAME_USE_TIMEZONE
  620. +     extern char *timezone();
  621. +     struct timeval tv;
  622. +     struct timezone zone;
  623. + #endif /* TZNAME_USE_TIMEZONE */
  624.   
  625.       /* various tables, useful in North America */
  626. !     static const char *days_a[] = {
  627.           "Sun", "Mon", "Tue", "Wed",
  628.           "Thu", "Fri", "Sat",
  629.       };
  630. !     static const char *days_l[] = {
  631.           "Sunday", "Monday", "Tuesday", "Wednesday",
  632.           "Thursday", "Friday", "Saturday",
  633.       };
  634. !     static const char *months_a[] = {
  635.           "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  636.           "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
  637.       };
  638. !     static const char *months_l[] = {
  639.           "January", "February", "March", "April",
  640.           "May", "June", "July", "August", "September",
  641.           "October", "November", "December",
  642.       };
  643. !     static const char *ampm[] = { "AM", "PM", };
  644.   
  645.       if (s == NULL || format == NULL || timeptr == NULL || maxsize == 0)
  646.           return 0;
  647.   
  648. +     /* quick check if we even need to bother */
  649.       if (strchr(format, '%') == NULL && strlen(format) + 1 >= maxsize)
  650.           return 0;
  651.   
  652. ***************
  653. *** 375,381 ****
  654.               break;
  655.   
  656.           case 'U':    /* week of year, Sunday is first day of week */
  657. !             sprintf(tbuf, "%d", weeknumber(timeptr, 0));
  658.               break;
  659.   
  660.           case 'w':    /* weekday, Sunday == 0, 0 - 6 */
  661. --- 410,416 ----
  662.               break;
  663.   
  664.           case 'U':    /* week of year, Sunday is first day of week */
  665. !             sprintf(tbuf, "%02d", weeknumber(timeptr, 0));
  666.               break;
  667.   
  668.           case 'w':    /* weekday, Sunday == 0, 0 - 6 */
  669. ***************
  670. *** 384,390 ****
  671.               break;
  672.   
  673.           case 'W':    /* week of year, Monday is first day of week */
  674. !             sprintf(tbuf, "%d", weeknumber(timeptr, 1));
  675.               break;
  676.   
  677.           case 'x':    /* appropriate date representation */
  678. --- 419,425 ----
  679.               break;
  680.   
  681.           case 'W':    /* week of year, Monday is first day of week */
  682. !             sprintf(tbuf, "%02d", weeknumber(timeptr, 1));
  683.               break;
  684.   
  685.           case 'x':    /* appropriate date representation */
  686. ***************
  687. *** 404,410 ****
  688.   
  689.           case 'y':    /* year without a century, 00 - 99 */
  690.               i = timeptr->tm_year % 100;
  691. !             sprintf(tbuf, "%d", i);
  692.               break;
  693.   
  694.           case 'Y':    /* year with century */
  695. --- 439,445 ----
  696.   
  697.           case 'y':    /* year without a century, 00 - 99 */
  698.               i = timeptr->tm_year % 100;
  699. !             sprintf(tbuf, "%02d", i);
  700.               break;
  701.   
  702.           case 'Y':    /* year with century */
  703. ***************
  704. *** 412,418 ****
  705.               break;
  706.   
  707.           case 'Z':    /* time zone name or abbrevation */
  708. !             strcpy(tbuf, get_tz_name(timeptr));
  709.               break;
  710.   
  711.   #ifdef SYSV_EXT
  712. --- 447,464 ----
  713.               break;
  714.   
  715.           case 'Z':    /* time zone name or abbrevation */
  716. ! #ifdef TZNAME_USE_TZNAME
  717. !             i = (daylight && timeptr->tm_isdst);    /* 0 or 1 */
  718. !             strcpy(tbuf, tzname[i]);
  719. ! #else
  720. ! #ifdef TZNAME_USE_TM_ZONE
  721. !             strcpy(tbuf, timeptr->tm_zone);
  722. ! #else
  723. !             gettimeofday(& tv, & zone);
  724. !             strcpy(tbuf, timezone(zone.tz_minuteswest,
  725. !                         timeptr->tm_isdst));
  726. ! #endif
  727. ! #endif
  728.               break;
  729.   
  730.   #ifdef SYSV_EXT
  731. ***************
  732. *** 465,471 ****
  733.   
  734.   #ifdef VMS_EXT
  735.           case 'v':    /* date as dd-bbb-YYYY */
  736. !             sprintf(tbuf, "%2d-%3.3s-%4d",
  737.                   range(1, timeptr->tm_mday, 31),
  738.                   months_a[range(0, timeptr->tm_mon, 11)],
  739.                   timeptr->tm_year + 1900);
  740. --- 511,517 ----
  741.   
  742.   #ifdef VMS_EXT
  743.           case 'v':    /* date as dd-bbb-YYYY */
  744. !             sprintf(tbuf, "%02d-%3.3s-%4d",
  745.                   range(1, timeptr->tm_mday, 31),
  746.                   months_a[range(0, timeptr->tm_mon, 11)],
  747.                   timeptr->tm_year + 1900);
  748. ***************
  749. *** 497,507 ****
  750.               if (! warned && do_lint) {
  751.                   warned = 1;
  752.                   warning(
  753. !     "conversion %%V added in P1003.2/11.3; for VMS style date, use %%v");
  754.               }
  755.           }
  756.   #endif
  757. !             sprintf(tbuf, "%d", iso8601wknum(timeptr));
  758.               break;
  759.   
  760.           case 'u':
  761. --- 543,553 ----
  762.               if (! warned && do_lint) {
  763.                   warned = 1;
  764.                   warning(
  765. !     "conversion %%V added in P1003.2; for VMS style date, use %%v");
  766.               }
  767.           }
  768.   #endif
  769. !             sprintf(tbuf, "%02d", iso8601wknum(timeptr));
  770.               break;
  771.   
  772.           case 'u':
  773. ***************
  774. *** 517,528 ****
  775.               break;
  776.           }
  777.           i = strlen(tbuf);
  778. !         if (i)
  779.               if (s + i < endp - 1) {
  780.                   strcpy(s, tbuf);
  781.                   s += i;
  782.               } else
  783.                   return 0;
  784.       }
  785.   out:
  786.       if (s < endp && *format == '\0') {
  787. --- 563,575 ----
  788.               break;
  789.           }
  790.           i = strlen(tbuf);
  791. !         if (i) {
  792.               if (s + i < endp - 1) {
  793.                   strcpy(s, tbuf);
  794.                   s += i;
  795.               } else
  796.                   return 0;
  797. +         }
  798.       }
  799.   out:
  800.       if (s < endp && *format == '\0') {
  801. ***************
  802. *** 532,537 ****
  803. --- 579,599 ----
  804.           return 0;
  805.   }
  806.   
  807. + /* isleap --- is a year a leap year? */
  808. + #if !ANSI_C
  809. + static int
  810. + isleap(year)
  811. + int year;
  812. + #else
  813. + static int
  814. + isleap(int year)
  815. + #endif
  816. + {
  817. +     return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
  818. + }
  819.   #ifdef POSIX2_DATE
  820.   /* iso8601wknum --- compute week number according to ISO 8601 */
  821.   
  822. ***************
  823. *** 545,564 ****
  824.   #endif
  825.   {
  826.       /*
  827. !      * From 1003.2 D11.3:
  828.        *    If the week (Monday to Sunday) containing January 1
  829.        *    has four or more days in the new year, then it is week 1;
  830. !      *    otherwise it is week 53 of the previous year, and the
  831. !      *    next week is week 1.
  832.        *
  833.        * ADR: This means if Jan 1 was Monday through Thursday,
  834. !      *    it was week 1, otherwise week 53.
  835.        */
  836.   
  837. !     int simple_wknum, jan1day, diff, ret;
  838.   
  839.       /* get week number, Monday as first day of the week */
  840. !     simple_wknum = weeknumber(timeptr, 1) + 1;
  841.   
  842.       /*
  843.        * With thanks and tip of the hatlo to tml@tik.vtt.fi
  844. --- 607,629 ----
  845.   #endif
  846.   {
  847.       /*
  848. !      * From 1003.2:
  849.        *    If the week (Monday to Sunday) containing January 1
  850.        *    has four or more days in the new year, then it is week 1;
  851. !      *    otherwise it is the highest numbered week of the previous
  852. !      *    (52 or 53) year, and the next week is week 1.
  853.        *
  854.        * ADR: This means if Jan 1 was Monday through Thursday,
  855. !      *    it was week 1, otherwise week 52 or 53.
  856. !      *
  857. !      * XPG4 erroneously included POSIX.2 rationale text in the
  858. !      * main body of the standard. Thus it requires week 53.
  859.        */
  860.   
  861. !     int weeknum, jan1day, diff;
  862.   
  863.       /* get week number, Monday as first day of the week */
  864. !     weeknum = weeknumber(timeptr, 1);
  865.   
  866.       /*
  867.        * With thanks and tip of the hatlo to tml@tik.vtt.fi
  868. ***************
  869. *** 579,595 ****
  870.   
  871.       /*
  872.        * If Jan 1 was a Monday through Thursday, it was in
  873. !      * week 1.  Otherwise it was last year's week 53, which is
  874.        * this year's week 0.
  875.        */
  876. !     if (jan1day >= 1 && jan1day <= 4)
  877. !         diff = 0;
  878. !     else
  879. !         diff = 1;
  880. !     ret = simple_wknum - diff;
  881. !     if (ret == 0)    /* we're in the first week of the year */
  882. !         ret = 53;
  883. !     return ret;
  884.   }
  885.   #endif
  886.   
  887. --- 644,690 ----
  888.   
  889.       /*
  890.        * If Jan 1 was a Monday through Thursday, it was in
  891. !      * week 1.  Otherwise it was last year's highest week, which is
  892.        * this year's week 0.
  893. +      *
  894. +      * What does that mean?
  895. +      * If Jan 1 was Monday, the week number is exactly right, it can
  896. +      *    never be 0.
  897. +      * If it was Tuesday through Thursday, the weeknumber is one
  898. +      *    less than it should be, so we add one.
  899. +      * Otherwise, Friday, Saturday or Sunday, the week number is
  900. +      * OK, but if it is 0, it needs to be 52 or 53.
  901.        */
  902. !     switch (jan1day) {
  903. !     case 1:        /* Monday */
  904. !         break;
  905. !     case 2:        /* Tuesday */
  906. !     case 3:        /* Wednedsday */
  907. !     case 4:        /* Thursday */
  908. !         weeknum++;
  909. !         break;
  910. !     case 5:        /* Friday */
  911. !     case 6:        /* Saturday */
  912. !     case 0:        /* Sunday */
  913. !         if (weeknum == 0) {
  914. ! #ifdef USE_BROKEN_XPG4
  915. !             /* XPG4 (as of March 1994) says 53 unconditionally */
  916. !             weeknum = 53;
  917. ! #else
  918. !             /* get week number of last week of last year */
  919. !             struct tm dec31ly;    /* 12/31 last year */
  920. !             dec31ly = *timeptr;
  921. !             dec31ly.tm_year--;
  922. !             dec31ly.tm_mon = 11;
  923. !             dec31ly.tm_mday = 31;
  924. !             dec31ly.tm_wday = (jan1day == 0) ? 6 : jan1day - 1;
  925. !             dec31ly.tm_yday = 364 + isleap(dec31ly.tm_year + 1900);
  926. !             weeknum = iso8601wknum(& dec31ly);
  927. ! #endif
  928. !         }
  929. !         break;
  930. !     }
  931. !     return weeknum;
  932.   }
  933.   #endif
  934.   
  935. ***************
  936. *** 607,615 ****
  937.   weeknumber(const struct tm *timeptr, int firstweekday)
  938.   #endif
  939.   {
  940. !     if (firstweekday == 0)
  941. !         return (timeptr->tm_yday + 7 - timeptr->tm_wday) / 7;
  942. !     else
  943. !         return (timeptr->tm_yday + 7 -
  944. !             (timeptr->tm_wday ? (timeptr->tm_wday - 1) : 6)) / 7;
  945.   }
  946. --- 702,858 ----
  947.   weeknumber(const struct tm *timeptr, int firstweekday)
  948.   #endif
  949.   {
  950. !     int wday = timeptr->tm_wday;
  951. !     int ret;
  952. !     if (firstweekday == 1) {
  953. !         if (wday == 0)    /* sunday */
  954. !             wday = 6;
  955. !         else
  956. !             wday--;
  957. !     }
  958. !     ret = ((timeptr->tm_yday + 7 - wday) / 7);
  959. !     if (ret < 0)
  960. !         ret = 0;
  961. !     return ret;
  962. ! }
  963. ! #if 0
  964. ! /* ADR --- I'm loathe to mess with ado's code ... */
  965. ! Date:         Wed, 24 Apr 91 20:54:08 MDT
  966. ! From: Michal Jaegermann <audfax!emory!vm.ucs.UAlberta.CA!NTOMCZAK>
  967. ! To: arnold@audiofax.com
  968. ! Hi Arnold,
  969. ! in a process of fixing of strftime() in libraries on Atari ST I grabbed
  970. ! some pieces of code from your own strftime.  When doing that it came
  971. ! to mind that your weeknumber() function compiles a little bit nicer
  972. ! in the following form:
  973. ! /*
  974. !  * firstweekday is 0 if starting in Sunday, non-zero if in Monday
  975. !  */
  976. ! {
  977. !     return (timeptr->tm_yday - timeptr->tm_wday +
  978. !         (firstweekday ? (timeptr->tm_wday ? 8 : 1) : 7)) / 7;
  979. ! }
  980. ! How nicer it depends on a compiler, of course, but always a tiny bit.
  981. !    Cheers,
  982. !    Michal
  983. !    ntomczak@vm.ucs.ualberta.ca
  984. ! #endif
  985. ! #ifdef    TEST_STRFTIME
  986. ! /*
  987. !  * NAME:
  988. !  *    tst
  989. !  *
  990. !  * SYNOPSIS:
  991. !  *    tst
  992. !  *
  993. !  * DESCRIPTION:
  994. !  *    "tst" is a test driver for the function "strftime".
  995. !  *
  996. !  * OPTIONS:
  997. !  *    None.
  998. !  *
  999. !  * AUTHOR:
  1000. !  *    Karl Vogel
  1001. !  *    Control Data Systems, Inc.
  1002. !  *    vogelke@c-17igp.wpafb.af.mil
  1003. !  *
  1004. !  * BUGS:
  1005. !  *    None noticed yet.
  1006. !  *
  1007. !  * COMPILE:
  1008. !  *    cc -o tst -DTEST_STRFTIME strftime.c
  1009. !  */
  1010. ! /* ADR: I reformatted this to my liking, and deleted some unneeded code. */
  1011. ! #ifndef NULL
  1012. ! #include    <stdio.h>
  1013. ! #endif
  1014. ! #include    <sys/time.h>
  1015. ! #include    <string.h>
  1016. ! #define        MAXTIME        132
  1017. ! /*
  1018. !  * Array of time formats.
  1019. !  */
  1020. ! static char *array[] =
  1021. ! {
  1022. !     "(%%A)      full weekday name, var length (Sunday..Saturday)  %A",
  1023. !     "(%%B)       full month name, var length (January..December)  %B",
  1024. !     "(%%C)                                               Century  %C",
  1025. !     "(%%D)                                       date (%%m/%%d/%%y)  %D",
  1026. !     "(%%E)                           Locale extensions (ignored)  %E",
  1027. !     "(%%H)                          hour (24-hour clock, 00..23)  %H",
  1028. !     "(%%I)                          hour (12-hour clock, 01..12)  %I",
  1029. !     "(%%M)                                       minute (00..59)  %M",
  1030. !     "(%%O)                           Locale extensions (ignored)  %O",
  1031. !     "(%%R)                                 time, 24-hour (%%H:%%M)  %R",
  1032. !     "(%%S)                                       second (00..61)  %S",
  1033. !     "(%%T)                              time, 24-hour (%%H:%%M:%%S)  %T",
  1034. !     "(%%U)    week of year, Sunday as first day of week (00..53)  %U",
  1035. !     "(%%V)                    week of year according to ISO 8601  %V",
  1036. !     "(%%W)    week of year, Monday as first day of week (00..53)  %W",
  1037. !     "(%%X)     appropriate locale time representation (%H:%M:%S)  %X",
  1038. !     "(%%Y)                           year with century (1970...)  %Y",
  1039. !     "(%%Z) timezone (EDT), or blank if timezone not determinable  %Z",
  1040. !     "(%%a)          locale's abbreviated weekday name (Sun..Sat)  %a",
  1041. !     "(%%b)            locale's abbreviated month name (Jan..Dec)  %b",
  1042. !     "(%%c)           full date (Sat Nov  4 12:02:33 1989)%n%t%t%t  %c",
  1043. !     "(%%d)                             day of the month (01..31)  %d",
  1044. !     "(%%e)               day of the month, blank-padded ( 1..31)  %e",
  1045. !     "(%%h)                                should be same as (%%b)  %h",
  1046. !     "(%%j)                            day of the year (001..366)  %j",
  1047. !     "(%%k)               hour, 24-hour clock, blank pad ( 0..23)  %k",
  1048. !     "(%%l)               hour, 12-hour clock, blank pad ( 0..12)  %l",
  1049. !     "(%%m)                                        month (01..12)  %m",
  1050. !     "(%%p)              locale's AM or PM based on 12-hour clock  %p",
  1051. !     "(%%r)                   time, 12-hour (same as %%I:%%M:%%S %%p)  %r",
  1052. !     "(%%u) ISO 8601: Weekday as decimal number [1 (Monday) - 7]   %u",
  1053. !     "(%%v)                                VAX date (dd-bbb-YYYY)  %v",
  1054. !     "(%%w)                       day of week (0..6, Sunday == 0)  %w",
  1055. !     "(%%x)                appropriate locale date representation  %x",
  1056. !     "(%%y)                      last two digits of year (00..99)  %y",
  1057. !     (char *) NULL
  1058. ! };
  1059. ! /* main routine. */
  1060. ! int
  1061. ! main(argc, argv)
  1062. ! int argc;
  1063. ! char **argv;
  1064. ! {
  1065. !     long time();
  1066. !     char *next;
  1067. !     char string[MAXTIME];
  1068. !     int k;
  1069. !     int length;
  1070. !     struct tm *tm;
  1071. !     long clock;
  1072. !     /* Call the function. */
  1073. !     clock = time((long *) 0);
  1074. !     tm = localtime(&clock);
  1075. !     for (k = 0; next = array[k]; k++) {
  1076. !         length = strftime(string, MAXTIME, next, tm);
  1077. !         printf("%s\n", string);
  1078. !     }
  1079. !     exit(0);
  1080.   }
  1081. + #endif    /* TEST_STRFTIME */
  1082.  
  1083. Index: nls/C/C/C/s_elmrc.m
  1084. *** ../elm2.4/nls/C/C/C/s_elmrc.m    Sat Oct 24 10:21:10 1992
  1085. --- nls/C/C/C/s_elmrc.m    Fri Mar 11 16:18:40 1994
  1086. ***************
  1087. *** 18,22 ****
  1088.   $ #SavedAuto
  1089.   9    # Saved automatically by ELM %s\n#\n\n
  1090.   $ Do not change the strings ON and OFF in the following message, leave them in English as shown
  1091. - $ #YesNoMeans
  1092. - 10    # For yes/no settings with ?, ON means yes, OFF means no\n\n
  1093. --- 18,20 ----
  1094.  
  1095. Index: nls/Makefile
  1096. *** ../elm2.4/nls/Makefile    Wed Nov 25 15:55:34 1992
  1097. --- nls/Makefile    Thu Mar 10 12:21:47 1994
  1098. ***************
  1099. *** 7,14 ****
  1100.   MSGCAT=    elm2.4.cat
  1101.   HFILES=    $(HDIR)/s_aliases.h \
  1102.       $(HDIR)/s_answer.h \
  1103. -     $(HDIR)/s_arepdaem.h \
  1104. -     $(HDIR)/s_autoreply.h \
  1105.       $(HDIR)/s_elm.h \
  1106.       $(HDIR)/s_elmrc.h \
  1107.       $(HDIR)/s_error.h \
  1108. --- 7,12 ----
  1109. ***************
  1110. *** 21,28 ****
  1111.   
  1112.   MFILES=    $(SDIR)/s_aliases.m \
  1113.       $(SDIR)/s_answer.m \
  1114. -     $(SDIR)/s_arepdaem.m \
  1115. -     $(SDIR)/s_autoreply.m \
  1116.       $(SDIR)/s_elm.m \
  1117.       $(SDIR)/s_elmrc.m \
  1118.       $(SDIR)/s_error.m \
  1119. --- 19,24 ----
  1120.  
  1121. Index: src/a_sort.c
  1122. Prereq: 5.5
  1123. *** ../elm2.4/src/a_sort.c    Sun Sep 26 22:14:56 1993
  1124. --- src/a_sort.c    Sat Mar 12 10:32:55 1994
  1125. ***************
  1126. *** 1,5 ****
  1127.   
  1128. ! static char rcsid[] = "@(#)$Id: a_sort.c,v 5.5 1993/06/12 05:27:44 syd Exp $";
  1129.   
  1130.   /*******************************************************************************
  1131.    *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  1132. --- 1,5 ----
  1133.   
  1134. ! static char rcsid[] = "@(#)$Id: a_sort.c,v 5.5 1993/06/12 05:27:44 syd Exp syd $";
  1135.   
  1136.   /*******************************************************************************
  1137.    *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  1138. ***************
  1139. *** 140,146 ****
  1140.           break;
  1141.   
  1142.       case TEXT_SORT:
  1143. !         diff = (first->length - second->length);
  1144.            if ( diff < 0 )    ret = -1;
  1145.            else if ( diff > 0 ) ret = 1;
  1146.            else ret = 0;
  1147. --- 140,146 ----
  1148.           break;
  1149.   
  1150.       case TEXT_SORT:
  1151. !         diff = (first - second);
  1152.            if ( diff < 0 )    ret = -1;
  1153.            else if ( diff > 0 ) ret = 1;
  1154.            else ret = 0;
  1155.  
  1156. Index: src/alias.c
  1157. Prereq: 5.37
  1158. *** ../elm2.4/src/alias.c    Sun Sep 26 22:14:56 1993
  1159. --- src/alias.c    Mon May 30 12:42:49 1994
  1160. ***************
  1161. *** 1,8 ****
  1162.   
  1163. ! static char rcsid[] = "@(#)$Id: alias.c,v 5.37 1993/08/03 19:28:39 syd Exp $";
  1164.   
  1165.   /*******************************************************************************
  1166. !  *  The Elm Mail System  -  $Revision: 5.37 $   $State: Exp $
  1167.    *
  1168.    *             Copyright (c) 1988-1992 USENET Community Trust
  1169.    *             Copyright (c) 1986,1987 Dave Taylor
  1170. --- 1,8 ----
  1171.   
  1172. ! static char rcsid[] = "@(#)$Id: alias.c,v 5.40 1994/05/30 16:42:48 syd Exp $";
  1173.   
  1174.   /*******************************************************************************
  1175. !  *  The Elm Mail System  -  $Revision: 5.40 $   $State: Exp $
  1176.    *
  1177.    *             Copyright (c) 1988-1992 USENET Community Trust
  1178.    *             Copyright (c) 1986,1987 Dave Taylor
  1179. ***************
  1180. *** 14,19 ****
  1181. --- 14,32 ----
  1182.    *
  1183.    *******************************************************************************
  1184.    * $Log: alias.c,v $
  1185. +  * Revision 5.40  1994/05/30  16:42:48  syd
  1186. +  * Just a minor fix to an impossible character comparison.
  1187. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1188. +  *
  1189. +  * Revision 5.39  1994/05/15  23:10:08  syd
  1190. +  * Below are the changes required to compile/link elm 2.4 pl23 under
  1191. +  * QNX 4.2 with the Watcom 9.5 compiler (very picky).
  1192. +  * From: "Brian Campbell" <brianc@quantum>
  1193. +  *
  1194. +  * Revision 5.38  1994/03/11  21:25:24  syd
  1195. +  * Fix Elm looping if an EOF is received.
  1196. +  * From: Gregory Neil Shapiro <gshapiro@WPI.EDU>
  1197. +  *
  1198.    * Revision 5.37  1993/08/03  19:28:39  syd
  1199.    * Elm tries to replace the system toupper() and tolower() on current
  1200.    * BSD systems, which is unnecessary.  Even worse, the replacements
  1201. ***************
  1202. *** 1017,1022 ****
  1203. --- 1030,1036 ----
  1204.           resize_screen = 0;
  1205.           if (newLINES != LINES || newCOLUMNS != COLUMNS) {
  1206.             LINES = newLINES, COLUMNS = newCOLUMNS;
  1207. + #undef max
  1208.   #define max(a,b)           ((a) < (b) ? (b) : (a))
  1209.             if (mini_menu)
  1210.           headers_per_page = max (LINES - 13, 1);
  1211. ***************
  1212. *** 1337,1343 ****
  1213.    *    Return non-0 if main part of screen overwritten, else 0
  1214.    */
  1215.       
  1216. !     char ch;
  1217.       int  redraw=0;
  1218.       char *alias_prompt;
  1219.       
  1220. --- 1351,1357 ----
  1221.    *    Return non-0 if main part of screen overwritten, else 0
  1222.    */
  1223.       
  1224. !     int  ch;
  1225.       int  redraw=0;
  1226.       char *alias_prompt;
  1227.       
  1228. ***************
  1229. *** 1360,1365 ****
  1230. --- 1374,1381 ----
  1231.   
  1232.       while ((ch = ReadCh()) != '.') {
  1233.         switch(ch) {
  1234. +         case EOF : leave(0);
  1235. +                    break;
  1236.           case '?' : display_helpfile(ALIAS_HELP);    
  1237.                  redraw++;
  1238.                  return(redraw);
  1239. ***************
  1240. *** 1855,1868 ****
  1241.       else {
  1242.           sprintf(buffer, "%s %s", firstname, lastname);
  1243.       }
  1244. !     PutLine3(LINES-1,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressAs,
  1245.               "Messages addressed as: %s (%s)"), address, buffer);
  1246.       if (strlen(comment) != 0) {
  1247.           strcat(buffer, ", ");
  1248.           strcat(buffer, comment);
  1249.       }
  1250.   
  1251. !     PutLine3(LINES-2,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressTo,
  1252.               "New alias: %s is '%s'."), aliasname, buffer);
  1253.       CleartoEOLN();
  1254.   /*
  1255. --- 1871,1884 ----
  1256.       else {
  1257.           sprintf(buffer, "%s %s", firstname, lastname);
  1258.       }
  1259. !     PutLine2(LINES-1,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressAs,
  1260.               "Messages addressed as: %s (%s)"), address, buffer);
  1261.       if (strlen(comment) != 0) {
  1262.           strcat(buffer, ", ");
  1263.           strcat(buffer, comment);
  1264.       }
  1265.   
  1266. !     PutLine2(LINES-2,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressTo,
  1267.               "New alias: %s is '%s'."), aliasname, buffer);
  1268.       CleartoEOLN();
  1269.   /*
  1270.  
  1271. Index: src/builtin.c
  1272. Prereq: 5.2
  1273. *** ../elm2.4/src/builtin.c    Sun Sep 26 22:14:57 1993
  1274. --- src/builtin.c    Mon May 30 12:42:49 1994
  1275. ***************
  1276. *** 1,8 ****
  1277.   
  1278. ! static char rcsid[] = "@(#)$Id: builtin.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  1279.   
  1280.   /*******************************************************************************
  1281. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  1282.    *
  1283.    *             Copyright (c) 1988-1992 USENET Community Trust
  1284.    *             Copyright (c) 1986,1987 Dave Taylor
  1285. --- 1,8 ----
  1286.   
  1287. ! static char rcsid[] = "@(#)$Id: builtin.c,v 5.4 1994/05/30 16:42:48 syd Exp $";
  1288.   
  1289.   /*******************************************************************************
  1290. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  1291.    *
  1292.    *             Copyright (c) 1988-1992 USENET Community Trust
  1293.    *             Copyright (c) 1986,1987 Dave Taylor
  1294. ***************
  1295. *** 14,19 ****
  1296. --- 14,30 ----
  1297.    *
  1298.    *******************************************************************************
  1299.    * $Log: builtin.c,v $
  1300. +  * Revision 5.4  1994/05/30  16:42:48  syd
  1301. +  * Just a minor fix to an impossible character comparison.
  1302. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1303. +  *
  1304. +  * Revision 5.3  1994/05/15  22:55:25  syd
  1305. +  * I had to put in some changes to builtin+ to allow it to display
  1306. +  * 8-bit letters as they should when the message has been sent
  1307. +  * through a real 8-bit channel like ESMTP with 8bit MIME Content-
  1308. +  * Transfer-Encoding.
  1309. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1310. +  *
  1311.    * Revision 5.2  1993/08/03  19:28:39  syd
  1312.    * Elm tries to replace the system toupper() and tolower() on current
  1313.    * BSD systems, which is unnecessary.  Even worse, the replacements
  1314. ***************
  1315. *** 139,157 ****
  1316.             iptr++;
  1317.             --ilen;
  1318.           }
  1319. !       } else if(isprint(*iptr & 0xff)) {    /* isprint requires int, mask to 8 bits to prevent sign ext. */
  1320. !         *optr++ = *iptr++;            /* printing character */
  1321.           chars_output++;
  1322.           --ilen;
  1323. -       } else {            /* non-white space control character */
  1324. -         if(chars_output + 2 <= width) {
  1325. -           *optr++ = '^';    
  1326. -           *optr++ = (*iptr == '\177' ? '?' : (*iptr&0177) + 'A' - 1);
  1327. -            iptr++; --ilen;
  1328. -           chars_output += 2;
  1329. -         } else {            /* no space on line for both chars */
  1330. -           break;
  1331. -         }
  1332.         }
  1333.       }
  1334.       *optr = '\0';
  1335. --- 150,168 ----
  1336.             iptr++;
  1337.             --ilen;
  1338.           }
  1339. !       } else if(iscntrl(*iptr & 0xff)) {    /* Non-white ctrl char */
  1340. !         if (chars_output + 2 <= width) {
  1341. !         *optr++ = '^';
  1342. !         *optr++ = ctrl(*iptr);
  1343. !         iptr++; --ilen;
  1344. !         chars_output += 2;
  1345. !         } else {
  1346. !         break;
  1347. !         }
  1348. !       } else {        /* Assume a printing char in case isprint */
  1349. !         *optr++ = *iptr++;    /* macro fails on true 8-bit characters.  */
  1350.           chars_output++;
  1351.           --ilen;
  1352.         }
  1353.       }
  1354.       *optr = '\0';
  1355. ***************
  1356. *** 178,185 ****
  1357.           it at this point)
  1358.       **/
  1359.       
  1360. !     char *pending, footer[SLEN], display_buffer[SLEN], ch;
  1361. !     int formfeed, lines_more;
  1362.       int pending_len = input_size, display_len = 0;
  1363.   
  1364.   #ifdef MMDF
  1365. --- 189,196 ----
  1366.           it at this point)
  1367.       **/
  1368.       
  1369. !     char *pending, footer[SLEN], display_buffer[SLEN];
  1370. !     int ch, formfeed, lines_more;
  1371.       int pending_len = input_size, display_len = 0;
  1372.   
  1373.   #ifdef MMDF
  1374.  
  1375. Index: src/curses.c
  1376. Prereq: 5.13
  1377. *** ../elm2.4/src/curses.c    Sun Sep 26 22:15:12 1993
  1378. --- src/curses.c    Mon May 30 12:27:44 1994
  1379. ***************
  1380. *** 1,8 ****
  1381.   
  1382. ! static char rcsid[] = "@(#)$Id: curses.c,v 5.13 1993/08/23 02:56:35 syd Exp $";
  1383.   
  1384.   /*******************************************************************************
  1385. !  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
  1386.    *
  1387.    *             Copyright (c) 1988-1992 USENET Community Trust
  1388.    *             Copyright (c) 1986,1987 Dave Taylor
  1389. --- 1,8 ----
  1390.   
  1391. ! static char rcsid[] = "@(#)$Id: curses.c,v 5.18 1994/05/30 16:27:44 syd Exp $";
  1392.   
  1393.   /*******************************************************************************
  1394. !  *  The Elm Mail System  -  $Revision: 5.18 $   $State: Exp $
  1395.    *
  1396.    *             Copyright (c) 1988-1992 USENET Community Trust
  1397.    *             Copyright (c) 1986,1987 Dave Taylor
  1398. ***************
  1399. *** 14,19 ****
  1400. --- 14,46 ----
  1401.    *
  1402.    *******************************************************************************
  1403.    * $Log: curses.c,v $
  1404. +  * Revision 5.18  1994/05/30  16:27:44  syd
  1405. +  * There was a typo in src/curses.c. An include read out like
  1406. +  * "# include <vararg.h>" though the file name should have been
  1407. +  * varargs.h.
  1408. +  * From: Jukka Antero Ukkonen <ukkonen@csc.fi>
  1409. +  *
  1410. +  * Revision 5.17  1994/05/15  23:10:08  syd
  1411. +  * Below are the changes required to compile/link elm 2.4 pl23 under
  1412. +  * QNX 4.2 with the Watcom 9.5 compiler (very picky).
  1413. +  * From: "Brian Campbell" <brianc@quantum>
  1414. +  *
  1415. +  * Revision 5.16  1994/05/15  22:58:36  syd
  1416. +  * Tune the Ultrix fix for ispell
  1417. +  * From: Bill Gianopoulos <wag@sccux1.msd.ray.com>
  1418. +  *
  1419. +  * Revision 5.15  1994/05/15  22:55:25  syd
  1420. +  * I had to put in some changes to builtin+ to allow it to display
  1421. +  * 8-bit letters as they should when the message has been sent
  1422. +  * through a real 8-bit channel like ESMTP with 8bit MIME Content-
  1423. +  * Transfer-Encoding.
  1424. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1425. +  *
  1426. +  * Revision 5.14  1994/03/11  20:45:03  syd
  1427. +  * fixed ReadCh() to recover from EINTR and EAGAIN instead
  1428. +  * of just returning an unexpected EOF.
  1429. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1430. +  *
  1431.    * Revision 5.13  1993/08/23  02:56:35  syd
  1432.    * have Writechar() backspace over the left edge of the screen to the end
  1433.    * of the previous line if the current line is not the first line on the
  1434. ***************
  1435. *** 100,105 ****
  1436. --- 127,137 ----
  1437.   
  1438.   #include "headers.h"
  1439.   
  1440. + #ifdef I_STDARG
  1441. + # include <stdarg.h>
  1442. + #else
  1443. + # include <varargs.h>
  1444. + #endif
  1445.   #ifdef TERMIOS
  1446.   # include <termios.h>
  1447.   # ifndef sun
  1448. ***************
  1449. *** 113,118 ****
  1450. --- 145,152 ----
  1451.   # endif
  1452.   #endif
  1453.   
  1454. + #include    <errno.h>
  1455.   #ifdef PTEM
  1456.   #  include <sys/stream.h>
  1457.   #  include <sys/ptem.h>
  1458. ***************
  1459. *** 754,760 ****
  1460.   #ifdef ASCII_CTYPE
  1461.         if(!isascii(ch) || !isprint(ch))
  1462.   #else
  1463. !       if(!isprint(ch))
  1464.   #endif
  1465.           ch = '?';
  1466.   
  1467. --- 788,794 ----
  1468.   #ifdef ASCII_CTYPE
  1469.         if(!isascii(ch) || !isprint(ch))
  1470.   #else
  1471. !       if(!isprint(ch) && !(ch & ~0x7f))
  1472.   #endif
  1473.           ch = '?';
  1474.   
  1475. ***************
  1476. *** 788,798 ****
  1477.   
  1478.   /*VARARGS2*/
  1479.   
  1480. ! Write_to_screen(line, argcount, arg1, arg2, arg3)
  1481.   char *line;
  1482.   int   argcount; 
  1483. ! char *arg1, *arg2, *arg3;
  1484.   {
  1485.       /** This routine writes to the screen at the current location.
  1486.             when done, it increments lines & columns accordingly by
  1487.           looking for "\n" sequences... **/
  1488. --- 822,844 ----
  1489.   
  1490.   /*VARARGS2*/
  1491.   
  1492. ! #ifdef    I_STDARG
  1493. ! Write_to_screen(char *line, int argcount, ...)
  1494. ! {
  1495. !     char *arg1, *arg2, *arg3;
  1496. !     va_list vl;
  1497. !     va_start(vl, argcount);
  1498. ! #else
  1499. ! Write_to_screen(line, argcount, va_alist)
  1500.   char *line;
  1501.   int   argcount; 
  1502. ! va_dcl
  1503.   {
  1504. +     char *arg1, *arg2, *arg3;
  1505. +     va_list vl;
  1506. +     va_start(vl);
  1507. + #endif
  1508.       /** This routine writes to the screen at the current location.
  1509.             when done, it increments lines & columns accordingly by
  1510.           looking for "\n" sequences... **/
  1511. ***************
  1512. *** 802,813 ****
  1513. --- 848,865 ----
  1514.           PutLine0(_line, _col, line);
  1515.           break;
  1516.       case 1 :
  1517. +         arg1 = va_arg(vl, char *);
  1518.           PutLine1(_line, _col, line, arg1);
  1519.           break;
  1520.       case 2 :
  1521. +         arg1 = va_arg(vl, char *);
  1522. +         arg2 = va_arg(vl, char *);
  1523.           PutLine2(_line, _col, line, arg1, arg2);
  1524.           break;
  1525.       case 3 :
  1526. +         arg1 = va_arg(vl, char *);
  1527. +         arg2 = va_arg(vl, char *);
  1528. +         arg3 = va_arg(vl, char *);
  1529.           PutLine3(_line, _col, line, arg1, arg2, arg3);
  1530.           break;
  1531.       }
  1532. ***************
  1533. *** 908,913 ****
  1534. --- 960,966 ----
  1535.   #ifdef ultrix
  1536.   force_raw()
  1537.   {
  1538. +     (void) ttsetattr(TTYIN,&_original_tty);
  1539.       _inraw = 0;
  1540.       Raw(ON);
  1541.   }
  1542. ***************
  1543. *** 955,966 ****
  1544.   int
  1545.   ReadCh()
  1546.   {
  1547. !     /** read a character with Raw mode set! **/
  1548.   
  1549. !     register int result;
  1550. !     char ch;
  1551. !     result = read(0, &ch, 1);
  1552. !         return((result <= 0 ) ? EOF : ch);
  1553.   }
  1554.   
  1555.   outchar(c)
  1556. --- 1008,1034 ----
  1557.   int
  1558.   ReadCh()
  1559.   {
  1560. !     /*
  1561. !      *    read a character with Raw mode set!
  1562. !      *
  1563. !      *    EAGAIN & EWOULDBLOCK are recognized just in case
  1564. !      *    O_NONBLOCK happens to be in effect.
  1565. !      */
  1566. !     register int    result;
  1567. !     unsigned char   ch;
  1568. !     while (((result = read(0, &ch, 1)) < 0)
  1569. !        && ((errno == EINTR)
  1570. ! #ifdef    EAGAIN
  1571. !            || (errno == EAGAIN)
  1572. ! #endif
  1573. ! #ifdef    EWOULDBLOCK
  1574. !            || (errno == EWOULDBLOCK)
  1575. ! #endif
  1576. !     ));
  1577.   
  1578. !     return((result <= 0 ) ? EOF : ch);
  1579.   }
  1580.   
  1581.   outchar(c)
  1582.  
  1583. Index: src/edit.c
  1584. Prereq: 5.7
  1585. *** ../elm2.4/src/edit.c    Sat May  8 16:25:36 1993
  1586. --- src/edit.c    Tue Aug 30 11:07:04 1994
  1587. ***************
  1588. *** 1,8 ****
  1589.   
  1590. ! static char rcsid[] = "@(#)$Id: edit.c,v 5.7 1993/05/08 20:25:33 syd Exp $";
  1591.   
  1592.   /*******************************************************************************
  1593. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  1594.    *
  1595.    *             Copyright (c) 1988-1992 USENET Community Trust
  1596.    *             Copyright (c) 1986,1987 Dave Taylor
  1597. --- 1,8 ----
  1598.   
  1599. ! static char rcsid[] = "@(#)$Id: edit.c,v 5.10 1994/08/30 15:07:03 syd Exp $";
  1600.   
  1601.   /*******************************************************************************
  1602. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  1603.    *
  1604.    *             Copyright (c) 1988-1992 USENET Community Trust
  1605.    *             Copyright (c) 1986,1987 Dave Taylor
  1606. ***************
  1607. *** 14,19 ****
  1608. --- 14,31 ----
  1609.    *
  1610.    *******************************************************************************
  1611.    * $Log: edit.c,v $
  1612. +  * Revision 5.10  1994/08/30  15:07:03  syd
  1613. +  * Extra } in edit_mailbox removed.
  1614. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  1615. +  *
  1616. +  * Revision 5.9  1994/06/03  17:05:17  syd
  1617. +  * try and prevent copy from calling elm_chown unless needed
  1618. +  * From: Syd
  1619. +  *
  1620. +  * Revision 5.8  1994/05/14  18:42:57  syd
  1621. +  * Here are some more of fixes to correctly call fflush() and unlock() in sequence.
  1622. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1623. +  *
  1624.    * Revision 5.7  1993/05/08  20:25:33  syd
  1625.    * Add sleepmsg to control transient message delays
  1626.    * From: Syd
  1627. ***************
  1628. *** 66,93 ****
  1629.   
  1630.   #ifdef ALLOW_MAILBOX_EDITING
  1631.   
  1632. ! static void copy_failed_emergency_exit(cur_folder, edited_file, linked)
  1633.   char *cur_folder, *edited_file;
  1634. - int linked;
  1635.   {
  1636.       int err = errno;
  1637.   
  1638.       MoveCursor(LINES, 0);
  1639.       Raw(OFF);
  1640.   
  1641. !     if (linked)
  1642. !         MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldntLinkMailfile,
  1643. !             "\nCouldn't link %s to mail file %s!\n"),
  1644. !             edited_file, cur_folder);
  1645. !     else
  1646. !         MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile,
  1647. !             "\nCouldn't copy %s to mail file %s!\n"),
  1648. !             cur_folder, edited_file);
  1649.   
  1650.       printf(catgets(elm_msg_cat, ElmSet, ElmCheckOutMail,
  1651.           "\nYou'll need to check out %s for your mail.\n"),
  1652.           edited_file);
  1653.       printf("** %s. **\n", error_description(err));
  1654.       unlock();                    /* ciao!*/
  1655.       emergency_exit();
  1656.   }
  1657. --- 78,102 ----
  1658.   
  1659.   #ifdef ALLOW_MAILBOX_EDITING
  1660.   
  1661. ! static void copy_failed_emergency_exit(cur_folder, edited_file)
  1662.   char *cur_folder, *edited_file;
  1663.   {
  1664.       int err = errno;
  1665.   
  1666.       MoveCursor(LINES, 0);
  1667.       Raw(OFF);
  1668.   
  1669. !     MCprintf(catgets(elm_msg_cat, ElmSet, ElmCouldntCopyMailfile,
  1670. !         "\nCouldn't copy %s to mail file %s!\n"),
  1671. !         cur_folder, edited_file);
  1672.   
  1673.       printf(catgets(elm_msg_cat, ElmSet, ElmCheckOutMail,
  1674.           "\nYou'll need to check out %s for your mail.\n"),
  1675.           edited_file);
  1676.       printf("** %s. **\n", error_description(err));
  1677. +     if (mailfile)
  1678. +         fflush (mailfile);
  1679.       unlock();                    /* ciao!*/
  1680.       emergency_exit();
  1681.   }
  1682. ***************
  1683. *** 130,135 ****
  1684. --- 139,146 ----
  1685.   
  1686.       if (folder_type == SPOOL) {    /* uh oh... now the toughie...  */
  1687.   
  1688. +       fflush (mailfile);
  1689.         if (bytes(cur_folder) != mailfile_size) {
  1690.   
  1691.            /* SIGH.  We've received mail since we invoked the editor
  1692. ***************
  1693. *** 159,164 ****
  1694. --- 170,177 ----
  1695.              sprintf(buffer, catgets(elm_msg_cat, ElmSet, ElmCouldntOpenFolder,
  1696.            "Couldn't open %s for reading!  Edit LOST!"), cur_folder);
  1697.              set_error(buffer);
  1698. +         fflush (mailfile);
  1699.              unlock();
  1700.              return(1);
  1701.            }
  1702. ***************
  1703. *** 168,173 ****
  1704. --- 181,188 ----
  1705.               mailfile_size, "edit_mailbox"));
  1706.              set_error(catgets(elm_msg_cat, ElmSet, ElmCouldntSeekEnd,
  1707.            "Couldn't seek to end of folder.  Edit LOST!"));
  1708. +         fflush (mailfile);
  1709.              unlock();
  1710.              return(1);
  1711.            }
  1712. ***************
  1713. *** 176,187 ****
  1714.   
  1715.            while ((len = mail_gets(buffer, SLEN, real_folder)) != 0)
  1716.              if (fwrite(buffer, 1, len, temp_folder) != len) {
  1717. !              copy_failed_emergency_exit(cur_folder, edited_file, FALSE);
  1718.              }
  1719.   
  1720.            fclose(real_folder);
  1721.            if (fclose(temp_folder)) {
  1722. !            copy_failed_emergency_exit(cur_folder, edited_file, FALSE);
  1723.            }
  1724.   
  1725.           } else lock(OUTGOING);
  1726. --- 191,202 ----
  1727.   
  1728.            while ((len = mail_gets(buffer, SLEN, real_folder)) != 0)
  1729.              if (fwrite(buffer, 1, len, temp_folder) != len) {
  1730. !              copy_failed_emergency_exit(cur_folder, edited_file);
  1731.              }
  1732.   
  1733.            fclose(real_folder);
  1734.            if (fclose(temp_folder)) {
  1735. !            copy_failed_emergency_exit(cur_folder, edited_file);
  1736.            }
  1737.   
  1738.           } else lock(OUTGOING);
  1739. ***************
  1740. *** 193,209 ****
  1741.          /* remove real mail_file and then
  1742.           * link or copy the edited mailfile to real mail_file */
  1743.   
  1744. !        (void)unlink(cur_folder);
  1745. !        if (link(edited_file, cur_folder) != 0)  {
  1746. !          if (errno == EXDEV || errno == EEXIST) {
  1747. !            /* attempt to link across file systems */
  1748. !               if (copy(edited_file, cur_folder) != 0) {
  1749. !              copy_failed_emergency_exit(cur_folder, edited_file, FALSE);
  1750. !            }
  1751. !          } else {
  1752. !              copy_failed_emergency_exit(cur_folder, edited_file, TRUE);
  1753. !          }
  1754.          }
  1755.   
  1756.          /* restore file permissions before removing lock */
  1757. --- 208,215 ----
  1758.          /* remove real mail_file and then
  1759.           * link or copy the edited mailfile to real mail_file */
  1760.   
  1761. !        if (copy(edited_file, cur_folder, TRUE) != 0) {
  1762. !           copy_failed_emergency_exit(cur_folder, edited_file);
  1763.          }
  1764.   
  1765.          /* restore file permissions before removing lock */
  1766. ***************
  1767. *** 220,225 ****
  1768. --- 226,232 ----
  1769.          setgid(groupid);
  1770.   #endif
  1771.   
  1772. +        fflush (mailfile);
  1773.          unlock();
  1774.          unlink(edited_file);    /* remove the edited mailfile */
  1775.          error(catgets(elm_msg_cat, ElmSet, ElmChangesIncorporated,
  1776.  
  1777. Index: src/editmsg.c
  1778. Prereq: 5.19
  1779. *** ../elm2.4/src/editmsg.c    Sun Sep 26 22:15:13 1993
  1780. --- src/editmsg.c    Thu Sep  1 15:42:40 1994
  1781. ***************
  1782. *** 1,8 ****
  1783.   
  1784. ! static char rcsid[] = "@(#)$Id: editmsg.c,v 5.19 1993/09/27 01:51:38 syd Exp $";
  1785.   
  1786.   /*******************************************************************************
  1787. !  *  The Elm Mail System  -  $Revision: 5.19 $   $State: Exp $
  1788.    *
  1789.    *             Copyright (c) 1988-1992 USENET Community Trust
  1790.    *            Copyright (c) 1986,1987 Dave Taylor
  1791. --- 1,8 ----
  1792.   
  1793. ! static char rcsid[] = "@(#)$Id: editmsg.c,v 5.21 1994/09/01 19:42:39 syd Exp $";
  1794.   
  1795.   /*******************************************************************************
  1796. !  *  The Elm Mail System  -  $Revision: 5.21 $   $State: Exp $
  1797.    *
  1798.    *             Copyright (c) 1988-1992 USENET Community Trust
  1799.    *            Copyright (c) 1986,1987 Dave Taylor
  1800. ***************
  1801. *** 14,19 ****
  1802. --- 14,30 ----
  1803.    *
  1804.    *******************************************************************************
  1805.    * $Log: editmsg.c,v $
  1806. +  * Revision 5.21  1994/09/01  19:42:39  syd
  1807. +  * Moved #defines for SETJMP & LONGJMP from src/editmsg.c to hdrs/defs.h and
  1808. +  * used them instead of (set|long)jmp directly. This makes the usage consistent
  1809. +  * and Solaris 2.3 behaves correctly w.r.t stop/continue.
  1810. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  1811. +  *
  1812. +  * Revision 5.20  1994/05/15  23:10:08  syd
  1813. +  * Below are the changes required to compile/link elm 2.4 pl23 under
  1814. +  * QNX 4.2 with the Watcom 9.5 compiler (very picky).
  1815. +  * From: "Brian Campbell" <brianc@quantum>
  1816. +  *
  1817.    * Revision 5.19  1993/09/27  01:51:38  syd
  1818.    * Add elm_chown to consolidate for Xenix not allowing -1
  1819.    * From: Syd
  1820. ***************
  1821. *** 144,163 ****
  1822.   #include "headers.h"
  1823.   #include "s_elm.h"
  1824.   #include <errno.h>
  1825. - #ifndef BSD
  1826. - /* BSD has already included setjmp.h in headers.h */
  1827. - #include <setjmp.h>
  1828. - #endif /* BSD */
  1829. - #if defined(POSIX_SIGNALS) && !defined(__386BSD__)
  1830. - # define JMP_BUF        sigjmp_buf
  1831. - # define SETJMP(env)        sigsetjmp((env), 1)
  1832. - # define LONGJMP(env,val)    siglongjmp((env), (val))
  1833. - #else
  1834. - # define JMP_BUF        jmp_buf
  1835. - # define SETJMP(env)        setjmp(env)
  1836. - # define LONGJMP(env,val)    longjmp((env), (val))
  1837. - #endif
  1838.   
  1839.   char *error_description(), *format_long(), *strip_commas();
  1840.   long  fsize();
  1841. --- 155,160 ----
  1842. ***************
  1843. *** 823,829 ****
  1844.           case '<' : NewLine();
  1845.                  if (strlen(buffer) < 3)
  1846.                    Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmUseSpecificCommand,
  1847. !          "(You need to use a specific command here. Continue.)\n\r"));
  1848.                  else {
  1849.                    sprintf(buf, " > %s%s.%d 2>&1", temp_dir, temp_edit, getpid());
  1850.                    strcat(buffer, buf);
  1851. --- 820,826 ----
  1852.           case '<' : NewLine();
  1853.                  if (strlen(buffer) < 3)
  1854.                    Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmUseSpecificCommand,
  1855. !          "(You need to use a specific command here. Continue.)\n\r"), 0);
  1856.                  else {
  1857.                    sprintf(buf, " > %s%s.%d 2>&1", temp_dir, temp_edit, getpid());
  1858.                    strcat(buffer, buf);
  1859.  
  1860. Index: src/elm.c
  1861. Prereq: 5.16
  1862. *** ../elm2.4/src/elm.c    Sun Sep 26 22:14:58 1993
  1863. --- src/elm.c    Mon May 30 12:26:14 1994
  1864. ***************
  1865. *** 1,8 ****
  1866.   
  1867. ! static char rcsid[] = "@(#)$Id: elm.c,v 5.16 1993/09/19 23:46:00 syd Exp $";
  1868.   
  1869.   /*******************************************************************************
  1870. !  *  The Elm Mail System  -  $Revision: 5.16 $   $State: Exp $
  1871.    *
  1872.    * This file and all associated files and documentation:
  1873.    *            Copyright (c) 1988-1992 USENET Community Trust
  1874. --- 1,8 ----
  1875.   
  1876. ! static char rcsid[] = "@(#)$Id: elm.c,v 5.21 1994/05/30 16:26:03 syd Exp $";
  1877.   
  1878.   /*******************************************************************************
  1879. !  *  The Elm Mail System  -  $Revision: 5.21 $   $State: Exp $
  1880.    *
  1881.    * This file and all associated files and documentation:
  1882.    *            Copyright (c) 1988-1992 USENET Community Trust
  1883. ***************
  1884. *** 15,20 ****
  1885. --- 15,41 ----
  1886.    *
  1887.    *******************************************************************************
  1888.    * $Log: elm.c,v $
  1889. +  * Revision 5.21  1994/05/30  16:26:03  syd
  1890. +  * Add protection to fflush on mailfile
  1891. +  * From: Syd
  1892. +  *
  1893. +  * Revision 5.20  1994/05/15  23:10:08  syd
  1894. +  * Below are the changes required to compile/link elm 2.4 pl23 under
  1895. +  * QNX 4.2 with the Watcom 9.5 compiler (very picky).
  1896. +  * From: "Brian Campbell" <brianc@quantum>
  1897. +  *
  1898. +  * Revision 5.19  1994/05/14  18:42:57  syd
  1899. +  * Here are some more of fixes to correctly call fflush() and unlock() in sequence.
  1900. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1901. +  *
  1902. +  * Revision 5.18  1994/03/12  15:22:43  syd
  1903. +  * Fix a line of debug output that is too long
  1904. +  * From: "C.R. Ritson" <C.R.Ritson@newcastle.ac.uk>
  1905. +  *
  1906. +  * Revision 5.17  1994/03/11  21:25:24  syd
  1907. +  * Fix Elm looping if an EOF is received.
  1908. +  * From: Gregory Neil Shapiro <gshapiro@WPI.EDU>
  1909. +  *
  1910.    * Revision 5.16  1993/09/19  23:46:00  syd
  1911.    * Although it doesnt solve the limit/resync problem of new
  1912.    * messages, allow them to be accessed anyway.
  1913. ***************
  1914. *** 174,179 ****
  1915. --- 195,201 ----
  1916.           resize_screen = 0;
  1917.           if (newLINES != LINES || newCOLUMNS != COLUMNS) {
  1918.             LINES = newLINES, COLUMNS = newCOLUMNS;
  1919. + #undef max
  1920.   #define max(a,b)           ((a) < (b) ? (b) : (a))
  1921.             if (mini_menu)
  1922.           headers_per_page = max (LINES - 13, 1);
  1923. ***************
  1924. *** 189,194 ****
  1925. --- 211,220 ----
  1926.   #endif
  1927.         nufoot = 0;
  1928.         nucurr = 0;
  1929. +       if (mailfile)
  1930. +           fflush (mailfile);
  1931.         if ((num = bytes(cur_folder)) != mailfile_size) {
  1932.           dprint(2, (debugfile, "Just received %d bytes more mail (elm)\n", 
  1933.               num - mailfile_size));
  1934. ***************
  1935. *** 514,520 ****
  1936.                    error(catgets(elm_msg_cat, ElmSet, ElmNewMailQuitCancelled,
  1937.                   "New Mail!  Quit canceled..."));
  1938.                    fflush(stdin);
  1939. !                    if (folder_type == SPOOL) unlock();
  1940.                  }
  1941.                  else
  1942.                    quit(TRUE);        
  1943. --- 540,550 ----
  1944.                    error(catgets(elm_msg_cat, ElmSet, ElmNewMailQuitCancelled,
  1945.                   "New Mail!  Quit canceled..."));
  1946.                    fflush(stdin);
  1947. !                  if (folder_type == SPOOL) {
  1948. !                 fflush (mailfile);
  1949. !                 unlock();
  1950. !                  }
  1951.                  }
  1952.                  else
  1953.                    quit(TRUE);        
  1954. ***************
  1955. *** 528,534 ****
  1956.                  if (mailfile_size != bytes(cur_folder)) {
  1957.                    error(catgets(elm_msg_cat, ElmSet, ElmNewMailQuickQuitCancelled,
  1958.                      "New Mail!  Quick Quit canceled..."));
  1959. !                    if (folder_type == SPOOL) unlock();
  1960.                  }
  1961.                  else
  1962.                    quit(FALSE);        
  1963. --- 558,567 ----
  1964.                  if (mailfile_size != bytes(cur_folder)) {
  1965.                    error(catgets(elm_msg_cat, ElmSet, ElmNewMailQuickQuitCancelled,
  1966.                      "New Mail!  Quick Quit canceled..."));
  1967. !                    if (folder_type == SPOOL) {
  1968. !                 fflush (mailfile);
  1969. !                 unlock();
  1970. !                  }
  1971.                  }
  1972.                  else
  1973.                    quit(FALSE);        
  1974. ***************
  1975. *** 748,754 ****
  1976.           current_header->from,
  1977.           current_header->subject);
  1978.   
  1979. !     Write_to_screen("\n\rPrimary Recipient: %s\nInternal Index Reference Number = %d\n\r", 2,
  1980.           current_header->to,
  1981.           current_header->index_number);
  1982.   
  1983. --- 781,787 ----
  1984.           current_header->from,
  1985.           current_header->subject);
  1986.   
  1987. !     Write_to_screen("\n\rPrimary Recipient: %s\n\rInternal Index Reference Number = %d\n\r", 2,
  1988.           current_header->to,
  1989.           current_header->index_number);
  1990.   
  1991. ***************
  1992. *** 905,910 ****
  1993. --- 938,946 ----
  1994.                    current = message_count;    
  1995.                  nucurr = get_page(current);
  1996.                  break;
  1997. +         case EOF    : leave(0);
  1998. +                           break;
  1999.   
  2000.           case ctrl('D') :
  2001.           case '^'    :
  2002.  
  2003. Index: src/file_util.c
  2004. Prereq: 5.10
  2005. *** ../elm2.4/src/file_util.c    Sun Sep 26 22:14:58 1993
  2006. --- src/file_util.c    Fri Jun  3 13:05:32 1994
  2007. ***************
  2008. *** 1,8 ****
  2009.   
  2010. ! static char rcsid[] = "@(#)$Id: file_util.c,v 5.10 1993/09/27 01:51:38 syd Exp $";
  2011.   
  2012.   /*******************************************************************************
  2013. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  2014.    *
  2015.    *            Copyright (c) 1988-1992 USENET Community Trust
  2016.    *            Copyright (c) 1986,1987 Dave Taylor
  2017. --- 1,8 ----
  2018.   
  2019. ! static char rcsid[] = "@(#)$Id: file_util.c,v 5.12 1994/06/03 17:05:17 syd Exp $";
  2020.   
  2021.   /*******************************************************************************
  2022. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  2023.    *
  2024.    *            Copyright (c) 1988-1992 USENET Community Trust
  2025.    *            Copyright (c) 1986,1987 Dave Taylor
  2026. ***************
  2027. *** 14,19 ****
  2028. --- 14,27 ----
  2029.    *
  2030.    *******************************************************************************
  2031.    * $Log: file_util.c,v $
  2032. +  * Revision 5.12  1994/06/03  17:05:17  syd
  2033. +  * try and prevent copy from calling elm_chown unless needed
  2034. +  * From: Syd
  2035. +  *
  2036. +  * Revision 5.11  1994/05/14  18:42:57  syd
  2037. +  * Here are some more of fixes to correctly call fflush() and unlock() in sequence.
  2038. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  2039. +  *
  2040.    * Revision 5.10  1993/09/27  01:51:38  syd
  2041.    * Add elm_chown to consolidate for Xenix not allowing -1
  2042.    * From: Syd
  2043. ***************
  2044. *** 122,129 ****
  2045.   }
  2046.   
  2047.   int
  2048. ! copy(from, to)
  2049.   char *from, *to;
  2050.   {
  2051.       /** this routine copies a specified file to the destination
  2052.           specified.  Non-zero return code indicates that something
  2053. --- 130,138 ----
  2054.   }
  2055.   
  2056.   int
  2057. ! copy(from, to, isspool)
  2058.   char *from, *to;
  2059. + int isspool;
  2060.   {
  2061.       /** this routine copies a specified file to the destination
  2062.           specified.  Non-zero return code indicates that something
  2063. ***************
  2064. *** 177,183 ****
  2065.           perror(to);
  2066.           return(1);
  2067.       }
  2068. !     (void) elm_chown( to, userid, groupid);
  2069.   
  2070.       return(0);
  2071.   }
  2072. --- 186,193 ----
  2073.           perror(to);
  2074.           return(1);
  2075.       }
  2076. !     if (!isspool)
  2077. !         (void) elm_chown( to, userid, groupid);
  2078.   
  2079.       return(0);
  2080.   }
  2081. ***************
  2082. *** 309,314 ****
  2083. --- 319,331 ----
  2084.       **/
  2085.   
  2086.       struct stat buffer;
  2087. +     /*
  2088. +      *  Make sure there is nothing in the stdio buffer
  2089. +      *  that is not also on the disk!!!!
  2090. +      */
  2091. +     fflush (fd);            
  2092.   
  2093.       (void) fstat(fileno(fd), &buffer);
  2094.   
  2095.  
  2096. Index: src/fileio.c
  2097. Prereq: 5.14
  2098. *** ../elm2.4/src/fileio.c    Sun Sep 26 22:14:58 1993
  2099. --- src/fileio.c    Tue Aug 30 11:08:09 1994
  2100. ***************
  2101. *** 1,8 ****
  2102.   
  2103. ! static char rcsid[] = "@(#)$Id: fileio.c,v 5.14 1993/09/27 01:51:38 syd Exp $";
  2104.   
  2105.   /*******************************************************************************
  2106. !  *  The Elm Mail System  -  $Revision: 5.14 $   $State: Exp $
  2107.    *
  2108.    *            Copyright (c) 1988-1992 USENET Community Trust
  2109.    *            Copyright (c) 1986,1987 Dave Taylor
  2110. --- 1,8 ----
  2111.   
  2112. ! static char rcsid[] = "@(#)$Id: fileio.c,v 5.16 1994/08/30 15:08:09 syd Exp $";
  2113.   
  2114.   /*******************************************************************************
  2115. !  *  The Elm Mail System  -  $Revision: 5.16 $   $State: Exp $
  2116.    *
  2117.    *            Copyright (c) 1988-1992 USENET Community Trust
  2118.    *            Copyright (c) 1986,1987 Dave Taylor
  2119. ***************
  2120. *** 14,19 ****
  2121. --- 14,30 ----
  2122.    *
  2123.    *******************************************************************************
  2124.    * $Log: fileio.c,v $
  2125. +  * Revision 5.16  1994/08/30  15:08:09  syd
  2126. +  * Add an fflush to detect over quota on file saves.
  2127. +  * From: Larry Schwimmer <rosebud@cyclone.Stanford.EDU>
  2128. +  *
  2129. +  * Revision 5.15  1994/08/30  15:06:37  syd
  2130. +  * The "copy_message" function in src/fileio.c incorrectly computes the
  2131. +  * size of the message.  The "bytes_seen" variable currently counts all
  2132. +  * bytes in the message ***including the message header*** when it should
  2133. +  * only be counting the bytes in the actual body of the message.
  2134. +  * From: Thomas Dwyer III <tomiii@mtu.edu>
  2135. +  *
  2136.    * Revision 5.14  1993/09/27  01:51:38  syd
  2137.    * Add elm_chown to consolidate for Xenix not allowing -1
  2138.    * From: Syd
  2139. ***************
  2140. *** 215,220 ****
  2141. --- 226,232 ----
  2142.         if (in_header && front_line) {
  2143.       if (buf_len < 2) {
  2144.         in_header = 0;
  2145. +       bytes_seen = 0;
  2146.         end_header = -1;
  2147.         if (remail && !sender_added) {
  2148.           if (fprintf(dest_file, "%sSender: %s\n", prefix, username) == EOF) {
  2149. ***************
  2150. *** 229,234 ****
  2151. --- 241,247 ----
  2152.   #endif /* MMDF */
  2153.           ) {
  2154.         in_header = 0;
  2155. +       bytes_seen = 0;
  2156.         end_header = 1;
  2157.         if (remail && !sender_added) {
  2158.           if (fprintf(dest_file, "%sSender: %s\n", prefix, username) == EOF) {
  2159. ***************
  2160. *** 394,399 ****
  2161. --- 407,420 ----
  2162.         copy_write_error_exit();
  2163.       }
  2164.   #endif /* MMDF */
  2165. +     /* Since fprintf is buffered, its return value is only useful for
  2166. +      * writes which exceed the blocksize.  Do a fflush to ensure that
  2167. +      * the message has, in fact, been written.
  2168. +      */
  2169. +     if (fflush(dest_file) == EOF) {
  2170. +       copy_write_error_exit();
  2171. +     }
  2172.   }
  2173.   
  2174.   static struct stat saved_buf;
  2175.  
  2176.